package controller;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao.GetSearchKeywordsRecommendationDAO;

public class GetSearchKeywordsRecommendationAction extends Action{

	@Override
	public String perform(HttpServletRequest request,
			HttpServletResponse response) {
		
		
		String add=request.getParameter("add");
		
		//case the first time come
		if(add==null||add.length()==0){
			return "getSearchKeywordsRecommendation.view";
		}
		
		//get user input information
		String keyword=request.getParameter("givenkeyword");		
		
		//update to ebay
		if(keyword!=null){
			String rs = GetSearchKeywordsRecommendationDAO.getSearchKeywordsRecommendation(keyword);
			request.setAttribute("rq", keyword);
			request.setAttribute("rs", rs);
		}
		return "getSearchKeywordsRecommendationResult.view";
	}

}
